import { withPageContainer } from '@/components';
import  './index.moudel.less';
import { RichText } from '@tarojs/components';
import Taro, { useRouter } from '@tarojs/taro';
import { defaultAgreementConfig } from './agreementConfig';

const Index = () => {
  const router = useRouter();
  const { type = '' } = router.params;
  const current = defaultAgreementConfig[type];
  const isH5 = Taro.getEnv() === Taro.ENV_TYPE.WEB;

  return (
    <div className={'privacy'}>
      <div className={'h2'}>{current?.title}</div>
      {isH5 ? (
        <div
          className={'content'}
          dangerouslySetInnerHTML={{ __html: current?.content || '' }}
        ></div>
      ) : (
        <RichText nodes={current?.content?.replace(/\n/g, '<br/>') || ''} />
      )}
    </div>
  );
};

export default withPageContainer(Index);